package cn.gson.zuche.controller.admin;

import java.io.IOException;
import java.io.PrintWriter;
import java.sql.SQLException;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.alibaba.fastjson.JSON;

import cn.gson.zuche.model.bean.Sijixiangche;
import cn.gson.zuche.model.dao.Sijixiangchedao;

/**
 * Servlet implementation class Cheliangdeletetupian
 */
@WebServlet("/deletetupian")
public class Cheliangdeletetupian extends HttpServlet {
	private Sijixiangchedao dao=new Sijixiangchedao();


	
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		String name=request.getParameter("name");
		String url=request.getParameter("url");		
				try {
					dao.delete(url);
					List<Sijixiangche> xc=dao.select(name);
					System.out.println(xc);
					PrintWriter out=response.getWriter();
					String jsonstring=JSON.toJSONString(xc);
					out.print(jsonstring);
				} catch (SQLException e) {
				
					e.printStackTrace();
				}
	}

}
